package com.zzt.zt_edittextinput;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.InputFilter;
import android.text.InputType;
import android.text.method.DigitsKeyListener;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;

import com.zzt.zt_edittextinput.util.NumCardUtil;
import com.zzt.zt_edittextinput.util.NumberAmountLengthFilter;
import com.zzt.zt_edittextinput.util.NumberCardSpaceFilter;
import com.zzt.zt_edittextinput.util.NumberDoubleZeroFilter;

public class MainActivity extends AppCompatActivity {
    EditText et_input;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        et_input = findViewById(R.id.et_input);


        setEditFilter(et_input);


    }

    private void setEditFilter(EditText editText) {

//         editText.setInputType(EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_SIGNED);
//         editText.setFilters(new InputFilter[]{new NumberDoubleZeroFilter()});
//
//
//         editText.setInputType(EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_SIGNED);
//         editText.setFilters(new InputFilter[]{
//         new NumberDoubleZeroFilter(),
//         new InputFilter.LengthFilter(6)});
//
//
//         editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
//         editText.setFilters(new InputFilter[]{
//         new NumberDoubleZeroFilter(),
//         new NumberAmountLengthFilter(true, 8, 4)});


//        editText.setFilters(new InputFilter[]{new NumberCardSpaceFilter(4, 12)});


        NumCardUtil.bankCardInput(editText);

    }
}